package com.xbongbong.saas.service;

import com.alibaba.fastjson.JSONArray;
import com.xbongbong.paas.domain.entity.PaasFormDataEntity;
import com.xbongbong.paas.pojo.dto.SaasFormSaveDTO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.saas.domain.entity.ContractProductEntity;
import com.xbongbong.saas.domain.entity.OutstockProductEntity;
import com.xbongbong.saas.domain.entity.PurchaseProductEntity;
import com.xbongbong.saas.domain.entity.ext.PurchaseEntityExt;

import java.util.List;
import java.util.Map;

/**
 * @author: wujian
 * @create: 2022-04-02 13:38
 * @description: 以销定购
 **/
public interface WaitPurchaseService {


    // 采购合同保存后更新采购结存和智能补货数据
//    void purchaseAfterSave(PurchaseEntityExt purchaseEntityExt,boolean isNew) throws XbbException;

    // 保存合同产品后更新对应采购结存和智能补货数据处理
    void formatContract(List<ContractProductEntity> insertList, List<ContractProductEntity> updateList, List<ContractProductEntity> delList, Map<Long,Double> changeBeforeNumMap,String corpid,Integer taskType)throws XbbException;

    // 采购合同产品保存后对应采购结存和智能补货数据处理
    void formatPurchase(String corpid,List<PurchaseProductEntity> productAddList,List<PurchaseProductEntity> updateList,List<PurchaseProductEntity> delList,Map<Long,Double> smartNumMap,Map<String,Double> waitPurchaseNumMap,boolean isAgainComit)throws XbbException;

    // 删除或者工作流 新建进审批后拒绝或撤回 采购合同时回滚数据
    void deletePurchase(String corpid,List<PurchaseProductEntity> purchaseProductEntityList) throws XbbException;

    // 新建销售出库单更新采购结存和智能补货数据
    void formatContractOutstock(String corpid,List<OutstockProductEntity> addOutstockProductEntityList)throws XbbException;

}
